package org.cosmos.modules.utils.sqls;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author fisher
 * @description Sql解析工厂类
 */

public class SqlMapUtil {
	private static Logger logger = LoggerFactory.getLogger(SqlMapUtil.class);

	private static SqlMapUtil _instance = new SqlMapUtil();

	private SqlMap _sqlMap;

	private SqlMapUtil() {
		try {
			_sqlMap = new SqlMap();
		} catch (Exception e) {
			logger.error("初始化Sql映射模板出错", e);
		}
	}

	public static String appendCriteria(String sql, String criteria) {
		return _instance._sqlMap.appendCriteria(sql, criteria);
	}

	public static String get(String id) {
		return _instance._sqlMap.get(id);
	}

	public static String get(String id, Map<String, Object> models) {
		return _instance._sqlMap.get(id, models);
	}
}